Assignments in the statistics courses in psychology at UoE will require you to submit according to one of the following:

If there is a template .Rmd file provided

For some assignments (DAPR1 Lab tests, DAPR1 Report, USMR Report) there is a template .Rmd file provided for you, in which you can write your answers.

  1. Download the .Rmd file from Learn (right click on the link, and choose “save as” to save to a location on your computer)
  2. Open the .Rmd
    • Option A. If you have RStudio installed on your computer, then open the downloaded .Rmd in Rstudio.
    • Option B.
      If you are using RStudio on the PPLS Server (rstudio.ppls.ed.ac.uk), you will need to upload the file to your server space

      Click on a screenshot to zoom in, then click on it to minimise it
  3. Save your file as B123456.Rmd (replace with your exam number)
    • file > save as
    • make sure that the file you are writing in from now on is this file.

      Click on a screenshot to zoom in, then click on it to minimise it
  4. Write! (and make sure to regularly save your document!)

If there is no template provided

If there is no template .Rmd file provided, this means that you are to write your assignment from a blank slate.

  1. Open Rstudio
  2. Create a new Rmarkdown document
  3. Save your file as B123456.Rmd (replace with your exam number)
    • file > save as
    • make sure that the file you are writing in from now on is this file.

      Click on a screenshot to zoom in, then click on it to minimise it
  4. Write! (and make sure to regularly save your document!)

Instructions on Learn for the specific assignment will provide you with guidance on how to structure your report, but some general tips are to try to include:

  1. Clear written details of the analysis conducted in order to answer the research question(s), including transparency with regards to decisions made about the data prior to and during analysis.
  2. Results, in appropriate detail (for instance, a test statistic, standard error and p-value, not just one of these).
  3. Presentation of results where appropriate (in the form of tables or plots).
  4. Interpretation (in the form of a written paragraph(s) referencing relevant parts of your results) leading to a conclusion regarding the research question(s).

The code you write should successfully conduct the analysis described in A), which returns B). You should also include the code to produce C).

Stop and think:
The compiled document will ideally contain no visible R code. This means that a large part of the challenge comes in clearly describing all aspects of the analysis procedure. A reader of your compiled document should be able to more or less replicate your analyses without referring to your R code.

Check that your code runs/that your document compiles


Click on a screenshot to zoom in, then click on it to minimise it

RMarkdown compiles using its own environment

When you “knit” an RMarkdown document, the document compiles starting from a blank slate. This means that if you haven’t written in your RMarkdown document where to read the data from, it will not be to access the data even if you can see the data in your environment (top-right window of RStudio).

It also means that you need to pay special attention to the order in which code is written in your document.

Consider the code below. I could run this code manually (in my environment) by running the second line (creating the kermit object) then the first line (calculating the mean). # When you knit an RMarkdown document with this code in it, it will run sequentially, which means that it will try to calculate the mean of kermit before it knows what kermit is!.

mean(kermit)
kermit <- c(5,7,2,5,205,3,5,3)

Common errors and things to look for

Check that everything is displaying correctly.

You can control whether the code in a code-chunk gets shown/evaluated etc using chunk-options such as echo, eval, include, warning, message etc. See here for more info.


Click on a screenshot to zoom in, then click on it to minimise it

Where (and what) are my files?

When you click “knit” on your .Rmd, if the document has successfully compiled (no errors), then the compiled document (e.g. .html) will be created in the same folder as where your .Rmd is saved.


Click on a screenshot to zoom in, then click on it to minimise it

  1. When you knit an RMarkdown document, the compiled document (unless there are errors in compilation) will be saved in the same place as your .Rmd document.
  2. It is one or both of these two files, B123456.Rmd and B123456.html which are required for submission (check assignment instructions)

Getting my file(s) to turnitin

If you are working on the Rstudio PPLS Server, you need to first export the file(s) to your computer.
1. Tick the box(es) next to relevant files
2. Click More, then Export
3. Save to your computer
(You won’t be able to open the .rmd on your computer (because you don’t have rstudio installed), but that is okay, you can still submit this file to turnitin.

If you are using Rstudio installed on your own computer, you can find both your files wherever you saved your .Rmd file!

Turnitin will show you a preview of files when you submit them, and the viewer will probably mess-up what the .html looks like. Do not worry if some figures and tables are not shown in Turnitin, but are definitely visible in your original file. We will mark the original files.